home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
dev
/
gcc
/
ixemulsrc.lha
/
ixemul-41.4
/
gnulib-soft-float
/
modf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-19
|
558b
|
26 lines
#include <inline/mathieeedoubbas.h>
/*
* modf(value, iptr): return fractional part of value, and stores the
* integral part into iptr (a pointer to double).
*/
double
modf (double value, double *iptr)
{
/* if value negative */
if (IEEEDPTst (value) < 0)
{
/* in that case, the integer part is calculated by ceil() */
*iptr = IEEEDPCeil (value);
return IEEEDPSub (*iptr, value);
}
else
{
/* if positive, we go for the floor() */
*iptr = IEEEDPFloor (value);
return IEEEDPSub (value, *iptr);
}
}